package com.woniu.controller;

import com.woniu.dto.InpatientAppQueryDTO;
import com.woniu.dto.RejectAdmissionDTO;
import com.woniu.entity.InpatientApplication;
import com.woniu.service.InpatientAppService;
import com.woniu.utils.ResponseEnum;
import com.woniu.utils.ResponseUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/inpatient-app")
public class InpatientAppController {
    @Resource
    private InpatientAppService inpatientAppService;
    @PostMapping("/list")
    public ResponseUtil list(@RequestBody InpatientAppQueryDTO queryDTO) {
        // 调用 Service 层方法，实现所有逻辑
        ResponseUtil result = inpatientAppService.listInpatientApps(queryDTO);
        return result;
    }
    @PostMapping("/add")
    public ResponseUtil addRecord(@RequestBody
                                      InpatientApplication inpatientApplication){
        ResponseUtil result = inpatientAppService.addRecord(inpatientApplication);
        return result;
    }
    //拒绝入院申请
    @PostMapping("/reject")
    public ResponseUtil rejectAdmission(@RequestBody RejectAdmissionDTO dto) {
        return inpatientAppService.rejectAdmission(dto);
    }
}
